
public class test {
    public static void main(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 100; i++) {
            //todo 1+2+3...+98+99+100
            System.out.println("sum:" + sum + "-----i:" + i);

            sum = sum + i;   //也可以写成：sum += i

        }
        System.out.println("最终结果为:"+sum);

    }
}
